﻿using EnvDTE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VisualPoint.Controls.Environments;
using VisualPoint.Controls.Models;

namespace VisualPoint.Controls.Actions
{
    public class ResizeAction : BaseAction
    {

        public override string Name
        {
            get
            {
                return "Resize";
            }
        }

        public override string Description
        {
            get
            {
                if (ResizeOption == Actions.ResizeOption.Configuration)
                {
                    return string.Format("Configuration: {0}", Configuration);
                }

                return ResizeOption.ToString();

            }
        }

        public override string Help
        {
            get
            {
                return "Resizes the window.";
            }
        }
        public override BaseActionModel CreateModel()
        {
            return new ResizeActionModel() { Action = this };
        }

        public override void Run()
        {
            VisualPoint.Controls.Environments.Environment.Current.Resize(ResizeOption, DockWith, DockAt, Configuration);
        }

        private ResizeOption _ResizeOption;
        public ResizeOption ResizeOption
        {
            get
            {
                return _ResizeOption;
            }
            set
            {
                if (_ResizeOption != value)
                {
                    _ResizeOption = value;
                    DoPropertyChanged("ResizeOption");
                    DoDescriptionChanged();
                }
            }
        }

        private string _DockWith;
        public string DockWith
        {
            get
            {
                return _DockWith;
            }
            set
            {
                if (_DockWith != value)
                {
                    _DockWith = value;
                    DoPropertyChanged("DockWith");
                    DoDescriptionChanged();
                }
            }
        }

        private vsLinkedWindowType _DockAt;
        public vsLinkedWindowType DockAt
        {
            get
            {
                return _DockAt;
            }
            set
            {
                if (_DockAt != value)
                {
                    _DockAt = value;
                    DoPropertyChanged("DockAt");
                    DoDescriptionChanged();
                }
            }
        }

        private string _Configuration;
        public string Configuration
        {
            get
            {
                return _Configuration;
            }
            set
            {
                if (_Configuration != value)
                {
                    _Configuration = value;
                    DoPropertyChanged("Configuration");
                    DoDescriptionChanged();
                }
            }
        }

        

        public override void InitializeNew()
        {
            DockAt = vsLinkedWindowType.vsLinkedWindowTypeDocked;
            DockWith = DteConstants.vsWindowKindSolutionExplorer;
        }

    }
}
